﻿<vuc:VNetUserControl x:Class="VNet.VisiSuite.Controls.MetroIconButton"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:vuc="clr-namespace:VNet.VisiSuite.Controls"
                     mc:Ignorable="d"
                     d:DesignHeight="300" d:DesignWidth="300">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <!--<ResourceDictionary Source="../Assets/Styles/AppStyles.xaml"/>-->
            </ResourceDictionary.MergedDictionaries>
            <vuc:MyContentTemplateSelector x:Key="myContentTemplateSelector" />
        </ResourceDictionary>
    </UserControl.Resources>

    <Button Width="41" Height="41" Padding="1" HorizontalAlignment="Center" VerticalAlignment="Center"
            Focusable="False" x:Name="_layout_root"
            Foreground="#FF00AADE" Background="White" BorderBrush="#FF00AADE" Click="OnButtonSelection"
            ToolTip="{Binding Tooltip}" ToolTipService.IsEnabled="{Binding ShowTooltip}">
        <Button.Template>
            <ControlTemplate TargetType="{x:Type Button}">
                <Grid x:Name="grid">
                    <Border x:Name="border" CornerRadius="20" BorderBrush="{Binding Foreground}" BorderThickness="2"
                            Background="{Binding Background}" Tag="{Binding Foreground}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="_content"
                                          Content="{Binding IconKey}"
                                          ContentTemplateSelector="{StaticResource myContentTemplateSelector}">
                            <ContentPresenter.RenderTransform>
                                <TransformGroup>
                                    <TransformCollection>
                                        <TranslateTransform X="-8" Y="-8" />
                                        <ScaleTransform ScaleX="0.6" ScaleY="0.6" />
                                    </TransformCollection>
                                </TransformGroup>
                            </ContentPresenter.RenderTransform>

                        </ContentPresenter>
                    </Border>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Background" TargetName="border" Value="{Binding Path=HoverColor}" />
                        <!-- was FFB7B7B7  FFB2E1EF-->
                    </Trigger>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter Property="Background" TargetName="border" Value="{Binding Path=Foreground}" />
                        <Setter Property="Tag" TargetName="border" Value="{Binding Path=Background}" />
                        <!--{Binding RelativeSource={RelativeSource Self}, Path=Foreground}" -->
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Opacity" TargetName="grid" Value="0.25" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Button.Template>
    </Button>
</vuc:VNetUserControl>